import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import Layout from '../views/Layout'
import Login from '../views/Login'
import Search from '../views/Search'
import SearchList from '../views/Search/list.vue'
import ProDetail from '../views/ProDetail'
import Pay from '../views/Pay'
import MyOrder from '../views/MyOrder'
import cart from '../views/Layout/cart.vue'
import category from '../views/Layout/category.vue'
import home from '../views/Layout/home.vue'
import user from '../views/Layout/user.vue'


Vue.use(VueRouter)

const routes = [{
        path: '/',
        component: Layout,
        children: [
            { path: '/', redirect: '/home' },
            { path: '/home', component: home },
            { path: '/category', component: category },
            { path: '/cart', component: cart },
            { path: '/user', component: user }
        ]
    },
    { path: '/login', component: Login },
    { path: '/search', component: Search },
    { path: '/searchList', component: SearchList },
    //动态路由传参，确认将来是哪个商品，路由参数中携带id
    { path: '/prodetail/:id', component: ProDetail },
    { path: '/pay', component: Pay },
    { path: '/myorder', component: MyOrder }
]

const router = new VueRouter({
    routes
})

export default router